//
//  TwoViewController.m
//  1
//
//  Created by 陈璟 on 16/1/21.
//  Copyright © 2016年 陈璟. All rights reserved.
//

#import "TwoViewController.h"
#import "MyView.h"

@interface TwoViewController ()
@property (nonatomic, copy) NSString *secondText;
@end

@implementation TwoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    
    
    self.view.backgroundColor = [UIColor blueColor];
    
    self.navigationItem.leftBarButtonItem = [[UIBarButtonItem alloc] initWithTitle:@"22" style:UIBarButtonItemStyleBordered target:self action:@selector(back)];
    
    
//    MyView *myView = [[MyView alloc] initWithFrame:CGRectMake(100, 200, 200, 200)];
    
    MyView *myView = [[NSBundle mainBundle] loadNibNamed:@"MyView" owner:nil options:nil].firstObject;
    myView.frame = CGRectMake(100, 200, 200, 200);
    [self.view addSubview:myView];
    
    [[NSNotificationCenter defaultCenter]addObserver:self selector:@selector(popToFirstController) name:@"popToRootViewController" object:nil];
    
}

- (void)back
{
    [self.navigationController popViewControllerAnimated:YES];
}

- (void)popToFirstController
{
    [self dismissViewControllerAnimated:YES completion:nil];
    
    
}


- (void)test1
{
    NSLog(@"test1");
}

+ (void)test2
{
    NSLog(@"test2dayin");
}



@end
